<template>
  <div id="activeTopSearch">
    <div class="search-box">
      <el-form
        ref="ruleForm"
        :inline="true"
        :model="formInline"
        :rules="rules"
        class="demo-form-inline"
      >
        <el-form-item label="查找" prop="activityId">
          <el-input
            v-model="formInline.dpAccount"
            placeholder="请输入大鹏号"
            clearable
          ></el-input>
        </el-form-item>
        <el-form-item class="s-btn">
          <el-button type="success" icon="el-icon-search" @click="toSearch()">
            查询
          </el-button>
          <el-button type="success" plain @click="reset">
            重置
          </el-button>
        </el-form-item>
      </el-form>
    </div>
  </div>
</template>

<script>
import { sysNormalDisable } from '@utils/dictionariesFunc'
import { getDay } from '@utils/yesterday.js'
export default {
  props: {
    formInline: {
      type: Object,
      default: function() {
        return {
          dpAccount: ''
        }
      }
    }
  },
  data() {
    return {
      time: [],
      checkCollege: '',
      collegeList: [],
      statusOptions: [
        {
          value: 'all',
          label: '全部'
        },
        {
          value: 'loading',
          label: '进行中'
        },
        {
          value: 'start',
          label: '未开始'
        },
        {
          value: 'end',
          label: '已结束'
        }
      ],
      activesOptions: [
        {
          value: 'all',
          label: '全部'
        },
        {
          value: 'loading',
          label: '邀请活动'
        },
        {
          value: 'zp',
          label: '转盘抽奖活动'
        },
        {
          value: 'fp',
          label: '翻牌抽奖活动'
        },
        {
          value: 'gg',
          label: '宫格抽奖活动'
        }
      ],
      activesValue: 'all',
      statusValue: 'all',
      userType: [],
      rules: {
        activityId: {},
        type: {},
        createTime: ''
      },
      pickerTopDataDay: {
        disabledDate(time) {
          //昨天之后不可选
          const yesterday = new Date() - 3600 * 1000 * 24 * 1
          return time.getTime() < yesterday
        }
      }
    }
  },
  mounted() {
    this.getColleges()
  },
  methods: {
    async getColleges() {
      let data = await sysNormalDisable('sys_college', 'sys_college')
      let addAll = [{ dictLabel: '全部', dictValue: '' }]
      this.collegeList = addAll.concat(data)
    },
    toSearch(formName) {
      this.$emit('toSearch')
    },
    /* 重置 */
    reset() {
      this.$refs['ruleForm'].resetFields()
      this.setDefaultValue()
    },
    setDefaultValue() {
      this.formInline.userName = ''
      this.formInline.statisticDate = getDay(-1, '-')
    }
  }
}
</script>

<style lang="less" scoped>
.search-box :deep(.el-input__inner) {
  padding: 0 30px;
}
</style>
